package com.dmall.algorithm.chapter01;

import java.util.Comparator;
import java.util.PriorityQueue;

public class PriorityQueueTest {

    public static void main(String[] args) {
        PriorityQueue<Integer> queue = new PriorityQueue<>(5, Comparator.reverseOrder());
        queue.add(4);
        queue.add(5);
        queue.add(3);
        queue.add(8);
        queue.add(6);
        while (!queue.isEmpty()) {
            Integer poll = queue.poll();
            System.out.println(poll);
        }
    }
}
